$(document).ready(function () {

    $.ajax({
        url: "/notesApi/toList.do",
        type: "get",
        success: function (result) {
            buildResourceTable(result)
        }
    })

    function buildResourceTable(result) {
        var res = result.extend.page.list;
        $.each(res, function (index, item) {
            console.log(item.id)
            var divT = $("<div class=\"collapse-card__heading\">\n" +
                "\t\t                <h4 class=\"collapse-card__title\">\n" +
                "\t\t                    " + item.title + "\n" +
                "\t\t                </h4>\n" +
                "\t\t\t\t\t\t<p>\n" + item.content +
                "\t\t\t\t\t\t</p>\n" +
                "<h4><a href='/notes/toEdit.do?id=" + item.id + "'>编辑文章</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
                "<a href='/views/notesList/deleteAlert.jsp?id=" + item.id + "'>删除</a></h4>" +
                "\t\t            </div>");

            $("<div class=\"collapse-card\"></div></br>\n")
                .append(divT)
                .appendTo(".container");
        })
    }

});